namespace SqlQueryBuilder.Clauses
{
    /// <summary>
    /// Insert Clause
    /// </summary>
    public class InsertClause : AbstractValueClause
    {
        #region Properties

        /// <summary>
        /// Gets or sets the field to insert in.
        /// </summary>
        /// <value>The field.</value>
        public string Field { get; set; }

        /// <summary>
        /// Gets or sets the value of the field.
        /// </summary>
        /// <value>The value.</value>
        public object Value { get; set; }

        #endregion
        
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="InsertClause"/> class.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="value">The new value.</param>
        public InsertClause(string field, object value)
        {
            Field = field;
            Value = value;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="InsertClause"/> class.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="literal">The literal.</param>
        public InsertClause(string field, SqlLiteral literal)
        {
            Field = field;
            Value = literal;
        }

        #endregion
        
        /// <summary>
        /// Literals the specified field.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="newValue">The new value.</param>
        /// <returns></returns>
        public static InsertClause Literal(string field, string newValue)
        {
            return new InsertClause(field, new SqlLiteral(newValue));
        }
    }
}